/* Copyright (C) 2006 Charlie C
*
* This software is provided 'as-is', without any express or implied
* warranty.  In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
*    claim that you wrote the original software. If you use this software
*    in a product, an acknowledgment in the product documentation would be
*    appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
*    misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
// Auto generated from makesdna dna.c
#ifndef __BLENDER_BEZTRIPLE__H__
#define __BLENDER_BEZTRIPLE__H__


// -------------------------------------------------- //
#include "blender_Common.h"

namespace Blender {

	/*
	While working with any of the Curve objects in Blender (bezier, Ipo Curves),
	you will run across the BezTriple data type. It's implementation can be somewhat confusing
	if you are more used to dealing with Blender's Listbase format.

	The BezTriple is a struct that contains several elements, 
	including a 3x3 matrix defined in the struct as "vec[3][3]". 
	The "vec" array refers to the data from the three parts of a Bezier point: 
	the actual point and its two handles. Each of the these three elements has,
	potentially, three associated values, one each for x, y, and z.
	When dealing with Ipo Curves or other two dimensional curves, the z value is extraneous.

	Here is how the values map into the array:

	vec[0][0]=x location of handle 1
	vec[0][1]=y location of handle 1
	vec[0][2]=z location of handle 1
	vec[1][0]=x location of control point
	vec[1][1]=y location of control point
	vec[1][2]=z location of control point
	vec[2][0]=x location of handle 2
	vec[2][1]=y location of handle 2
	vec[2][2]=z location of handle 2
	As stated above, when dealing with Ipo Curves, the vec[2][] portion is irrelevant.

	A final note on the implementation of BezTriples in Curves is that although a 
	Nurb can contain multiple BezTriples to actually define the curve in space, 
	these multiple instances are not contained in a Listbase. 
	The *bezt pointer in the case of Nurbs points not to a Listbase,
	but to the first element in a simple array of BezTriples. 
	This is why in the code you will notice implementations first counting the number of points,
	then working through them by incrementing the *bezt point (bezt++), 
	while decrementing the counter (usually a--).

	If the bezt element of Nurbs pointed to a Listbase this sort of thing would not be necessary, 
	as you would simply loop through the Listbase in the common fashion.
	It is also why you see the entire memory space for the array being copied 
	and pushed around when new BezTriples (points) are added to a curve.
	*/
    class BezTriple
    {
    public:
        float vec[3][3];
        float alfa;
        float weight;
        float radius;
        short h1;
        short h2;
        char f1;
        char f2;
        char f3;
        char hide;
    };
}


#endif//__BLENDER_BEZTRIPLE__H__
